#include <stdio.h>
#include <string.h>
#include <ctype.h>
char* reverse(char* arr, int o)
{
    char x[100000] = { 0 };
    int r = o;
    int l = o - 1;
    int i = 0;
    int num = 0;
    for (i = o - 1; i >= 0; i--)
    {
        if (!(isalpha(arr[i])) || i == 0)
        {
            if (i == 0)
            {
                l = 0;
            }
            while (l < r)
            {
                if (isalpha(*(arr + l)))
                    x[num++] = *(arr + l);
                l++;
            }
            x[num++] = ' ';
            r = i;
        }
        l = i;
    }
    return x;
}

int main() {
    char arr[100000] = { 0 };
    gets_s(arr);
    int x = strlen(arr);
    char* w = reverse(arr, x);
    int i = 0;
    printf("%s", w);
    return 0;
}